import java.util.Scanner;
import java.util.Stack;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class MainAB5 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine() ;
        Stack<Character> stack1 = new Stack<>() ;
        Stack<Character> stack2 = new Stack<>() ;
        int len = str.length() ;
        for(int i=0 ; i < len ; i ++){
            stack1.push(str.charAt(i)) ; 
        }
        boolean flg = true ;
        while(flg){
           flg = false ;
           while(!stack1.empty()){
              char ch = stack1.pop() ;
              if(!stack2.empty() && stack2.peek().equals(ch)){
                 stack2.pop() ;
                 flg = true ;
              }else{
                stack2.push(ch) ; 
              }
           }
            while(!stack2.empty()){
                stack1.push(stack2.pop()) ; 
            }
        }
         if(stack1.empty()){
            System.out.println(0) ; 
         }else{ 
            StringBuilder strbu = new StringBuilder() ;
            while(!stack1.empty()){
                strbu.append(stack1.pop()) ; 
            }   
            strbu.reverse();
                        System.out.println(strbu) ; 
         }                          
    }
}